<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>22-显式转换</title>
  </head>
  <body>
    <script>
      // Number(数据)
      //parseInt(数据)  只保留整数
      //parseFloat(数据)  只保留小数
      //isNaN(数据)  判断是否是数字
      let str = '123'
      console.log(Number(str))
      let num = 456

      console.log(parseInt('12px'))
      console.log(parseInt('12.34px'))
      //-------------
      console.log(parseFloat('12px'))
      console.log(parseFloat('12.34px'))

      console.log(num.toString())
      console.log(typeof num.toString())
      console.log(typeof num.toString)
    </script>
  </body>
</html>
